/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.controller;

import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
import queenb.net.entitybean.C425;
import queenb.web.store.C425Store;
import queenb.web.util.ComboboxUtil;
import queenb.web.util.SessionProvider;
import queenb.web.util.Util;

/**
 *
 * @author Nguyen Hung
 */
public class C425Controller extends QueenbController {

    private int PC425;
    private String CV426;
    private String CV427;
    private String CV428;
    private int CN429;
    private C425Store c425Store;
    private List<SelectItem> cbbC425 = new ArrayList<SelectItem>();
    private List<C425> ccurpks_listoftabc425 = new ArrayList<C425>();

    public C425Controller() {
        c425Store = new C425Store();
        Object action = getRequest().getParameter("action");
        if (action != null) {
            if (action.equals("editC425")) {
                Object objPC425 = getRequest().getParameter("pc425");
                if (objPC425 != null) {
                    PC425 = Util.parseInt(objPC425);

                    List<C425> list = c425Store.ccurpks_listoftabc425(getLogin().getModule(), getLogin().getCompanyNo(), 0, getLogin().getUserName());
                    if (list != null) {
                        for (int i = 0; i < list.size(); i++) {
                            if (list.get(i).getPc425() == PC425) {
                                CV426 = list.get(i).getCv426();
                                CV427 = list.get(i).getCv427();
                                CV428 = list.get(i).getCv428();
                                CN429 = list.get(i).getCn429();
                            }
                        }
                    }
                }
            } else if (action.equals("deleteC425")) {
                Object objPC425 = getRequest().getParameter("pc425");
                if (objPC425 != null) {
                    PC425 = Util.parseInt(objPC425);
                    SessionProvider.setSessionMapValue("IDC425DELETE", PC425);
                }
            }
        }
    }
    
     public void stdc_tools_stornotabc350() {
        try {
            int count = c425Store.stdc_tools_stornotabc425(Util.parseInt(SessionProvider.getSessionMapValue("IDC425DELETE")), getLogin().getUserName());
            if (count != 0) {
               
                System.out.println("-----THAM SO----");
            } else {
              
            }
        } catch (Exception e) {
        }
    }
//    
//    public List<C425> ccurpks_listoftabc425(){
//        try {
//            List<C425> listC425 = c425Store.ccurpks_listoftabc425(getLogin().getModule(), getLogin().getCompanyNo(), PC425, getLogin().getUserName());
//            return listC425;
//        } catch (Exception e) {
//            return null;
//        }
//    }

    public void stdc_tools_inserttabc425() {
        try {
            System.out.println("-----THAM SO-----" + PC425 + "," + getLogin().getModule() + "," + getLogin().getCompanyNo() + "," + CV426 + "," + CV427 + "," + CV428 + "," + CN429 + "," + getLogin().getUserName());
            int count = c425Store.stdc_tools_inserttabc425(PC425, getLogin().getModule(), getLogin().getCompanyNo(), CV426, CV427, CV428, CN429, getLogin().getUserName());
            if (count != 0) {
                showGlobalReport(true, getResourceString("success"));

            } else {
                showGlobalReport(true, getResourceString("error"));
            }

            sendRedirectUrlTab("setting.jsp?tab=header32&llinkC425=" + Util.convertMD5(getRequest().getRequestURI()));
        } catch (Exception e) {
        }
    }

    /**
     * @return the PC425
     */
    public int getPC425() {
        return PC425;
    }

    /**
     * @param PC425 the PC425 to set
     */
    public void setPC425(int PC425) {
        this.PC425 = PC425;
    }

    /**
     * @return the CV426
     */
    public String getCV426() {
        return CV426;
    }

    /**
     * @param CV426 the CV426 to set
     */
    public void setCV426(String CV426) {
        this.CV426 = CV426;
    }

    /**
     * @return the CV427
     */
    public String getCV427() {
        return CV427;
    }

    /**
     * @param CV427 the CV427 to set
     */
    public void setCV427(String CV427) {
        this.CV427 = CV427;
    }

    /**
     * @return the CV428
     */
    public String getCV428() {
        return CV428;
    }

    /**
     * @param CV428 the CV428 to set
     */
    public void setCV428(String CV428) {
        this.CV428 = CV428;
    }

    /**
     * @return the CN429
     */
    public int getCN429() {
        return CN429;
    }

    /**
     * @param CN429 the CN429 to set
     */
    public void setCN429(int CN429) {
        this.CN429 = CN429;
    }

    /**
     * @return the ccurpks_listoftabc425
     */
    public List<C425> getCcurpks_listoftabc425() {
        try {
            ccurpks_listoftabc425 = c425Store.ccurpks_listoftabc425(getLogin().getModule(), getLogin().getCompanyNo(), PC425, getLogin().getUserName());
            return ccurpks_listoftabc425;
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * @param ccurpks_listoftabc425 the ccurpks_listoftabc425 to set
     */
    public void setCcurpks_listoftabc425(List<C425> ccurpks_listoftabc425) {
        this.ccurpks_listoftabc425 = ccurpks_listoftabc425;
    }

    /**
     * @return the cbbC425
     */
    public List<SelectItem> getCbbC425() {
        ComboboxUtil combo = new ComboboxUtil();
        cbbC425 = combo.getSelectedC425Comb();
        return cbbC425;
    }

    /**
     * @param cbbC425 the cbbC425 to set
     */
    public void setCbbC425(List<SelectItem> cbbC425) {
        this.cbbC425 = cbbC425;
    }
}
